package com.nunbey.lingxi.activities;


import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.widget.TextView;

import com.nunbey.lingxi.R;
import com.nunbey.lingxi.activities.sub.SubBaseActivity;
import com.nunbey.lingxi.lincat.activityinit.BaseActivity;
import com.nunbey.lingxi.module.mode.record.EcgRecordReceive;

public class EcgRecordActivity extends BaseActivity {

    private static  EcgRecordReceive receive;

    @Override
    public void onCreate(Bundle savedInstancedState) {
        super.onCreate(savedInstancedState);
        //去掉标题栏
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        this.setContentView(R.layout.activity_ecg_record);
    }

    @Override
    protected void onStart() {
        super.onStart();
        this.dataInit();
    }

    public static void startEcgRecordActivity(Context context, EcgRecordReceive receive){
        context.startActivity(new Intent(context,EcgRecordActivity.class));
        EcgRecordActivity.receive = receive;
    }

    private void dataInit(){
        TextView rate = (TextView) findViewById(R.id.activity_ecg_record_rate);
        TextView predict = (TextView) findViewById(R.id.activity_ecg_record_predict);
        TextView r = (TextView) findViewById(R.id.activity_ecg_record_r);
        TextView relaxation = (TextView) findViewById(R.id.activity_ecg_record_relaxtion);
        TextView respiration = (TextView) findViewById(R.id.activity_ecg_record_respiration);
        TextView age = (TextView) findViewById(R.id.activity_ecg_record_age);
        TextView level = (TextView) findViewById(R.id.activity_ecg_record_level);
        TextView warn = (TextView) findViewById(R.id.activity_ecg_record_warn);
        TextView time = (TextView) findViewById(R.id.activity_ecg_record_time);
        rate.setText(Integer.toString(receive.getAverageRate()));
        predict.setText(receive.getDistinguish());
        r.setText(Integer.toString(receive.getR_r_interval()));
        relaxation.setText(Integer.toString(receive.getRelaxation()));
        respiration.setText(Float.toString(receive.getRespiration()));
        age.setText(Integer.toString(receive.getHeartAge()));
        level.setText(receive.getHeartFitnessLevelLabel());
        warn.setText(Integer.toString(receive.getHeartRiskAwareness()));
        String timeString = receive.getRecordTime().toString();
        timeString = timeString.substring(0,timeString.lastIndexOf('.'));
        time.setText(timeString);
    }


}